//
//  QZDateManager.m
//  WeiWeiHaircut
//
//  Created by apple on 16/1/4.
//  Copyright © 2016年 超群. All rights reserved.
//

#import "QZDateManager.h"
static QZDateManager *_manager = nil;
@implementation QZDateManager

+(instancetype)sharedDateManager{

    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        
        _manager = ([[QZDateManager alloc] init]);
    });

    return _manager;
}
/**
 *  时间字符串 转换成时间戳
 *
 *  @param time 时间字符串
 *
 *  @return 返回时间戳
 */
-(NSString *)stringTimeToSecond:(NSString *)time{
    
    NSDateFormatter *myFormatter = [[NSDateFormatter alloc] init];
    myFormatter.dateFormat = @"yyyy-MM-dd";
    NSDate *date = [myFormatter dateFromString:time];
    
    NSInteger tmpTime = [date timeIntervalSince1970];
    NSString *times = [NSString stringWithFormat:@"%ld",tmpTime];
    return times;
}

//时间戳 转 时间字符串
-(NSString *)secondToStringTIme:(NSString *)second{
    NSInteger time = [second integerValue];
    
    NSDate *data =[NSDate dateWithTimeIntervalSince1970:time];
    
    NSDateFormatter *myFormatter = [[NSDateFormatter alloc] init];
    myFormatter.dateFormat = @"yyyy-MM-dd HH:mm";
    
    return [myFormatter stringFromDate:data];
}
@end
